var request = require('request');
var _ = require('underscore');

module.exports = {
    get: function(url,callback) {
        request.get({
            url: url
        },
        function(err, response, body) {
            if (!err && response.statusCode == 200) {
                callback(body);
            }
        })
    },
    post:function(queryParams,callback){


        var queryParamFactory={
            "__VIEWSTATE":"/wEPDwULLTE5ODM5MjcxNzlkZG5FgcZjEw/Xcik6rLaQKQqjiJG1N/LcEaJpbqk1zMfT",
            "__VIEWSTATEGENERATOR":"7BCA6D38",
            "__EVENTVALIDATION":"/wEWBQKV37ujDALq+uyKCAKkmJj/DwL0+sTIDgLl5vKEDjV831PkO9I9rzINcIDwIwK31J8x9g8zuNZKL7+XkZX5",
        }

        for (var i in queryParams){
            queryParamFactory[i]=queryParams[i];
        }

        request.post({
            url: 'http://www.szjt.gov.cn/apts/default.aspx',
            form:queryParamFactory
        },
        function(err, response, body) {
            if (!err && response.statusCode == 200) {
                callback(body);
            }
        })
    }
}


